package basic.test;

import org.junit.Test;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/7/31 8:30
 */
public class XM2 {

    /**
     * 获得两个整形二进制表达位数不同的数量
     *
     * @param m 整数m
     * @param n 整数n
     * @return 整型
     */
    public int countBitDiff(int m, int n) {
        int t = m ^ n;
        int c = 0;
        int count = 0;
        while(c < 32){
            if((t & 1) == 1){
                count++;
            }
            t = t >> 1;
            c++;
        }
        return count;
    }

    @Test
    public void test(){
        System.out.println(countBitDiff(1999,2299));
    }
}
